Binary Tree Level Order Traversal from Right to Left

Easy

Question

Given the root of a tree, return a list of lists of the node values in the tree in level order traversal from right to left (top to bottom, right to left).

Binary Tree Level Order Traversal from Right to Left Example 1

Input: root = [1, 2, 3, 4, None, 6, 7]

Output: [[1], [3, 2], [7, 6, 4]]

Binary Tree Level Order Traversal from Right to Left Example 2

Input: root = [5, 9, None]

Output: [[5], [9]]

Clarify the problem

What are some questions you'd ask an interviewer?

Understand the problem

What is the expected output if the given tree is the following? [10, 5, 15, 3, 7, None, 18]
[[10], [5, 15], [3, 7, 18]]
[[10], [5, 15], [18, None, 7, 3]]
[[18, 7, 3], [15, 5], [10]]
[[10], [15, 5], [18, 7, 3]]

Login or signup to save your code.

Notes